const idpools=[];
let id=-1;
class ids{
    static generate(){
        if(idpools.length>0){
            return idpools.pop();
        }else{
            ++id;
            return id.toString();
        }
    }
    static recovery(id){
        idpools.push(id);
    }
    static toColor(id){
        let r = ( id >> 16 & 255 ) / 255;
        let g = ( id >> 8 & 255 ) / 255;
        let b = ( id & 255 ) / 255;
        return new Float32Array([r,g,b]);
    }
    static fromColor(color){
        let id=((color[ 0 ]) << 16 ) | ( (color[ 1 ]) << 8 ) | ( color[ 2 ]);
        return id.toString();
    }
}
export {ids}